package com.yby6.face.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yby6.common.utils.DateUtils;
import com.yby6.face.domain.SysUserFaceInfo;
import com.yby6.face.mapper.SysUserFaceInfoMapper;
import com.yby6.face.service.SysUserFaceInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @program: yangbuyi-rbac
 * @ClassName: SysUserFaceInfoServiceImpl
 * @create: 2022-04-24 01:15
 * @author: Yang Shuai
 * @since： JDK1.8
 * @SysUserFaceInfoServiceImpl: ${desc}$
 **/
@Service
@RequiredArgsConstructor
public class SysUserFaceInfoServiceImpl extends ServiceImpl<SysUserFaceInfoMapper, SysUserFaceInfo> implements SysUserFaceInfoService {
    private final SysUserFaceInfoMapper sysUserFaceInfoMapper;

    @Override

    public int deleteByPrimaryKey(Integer id) {
        return sysUserFaceInfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SysUserFaceInfo record) {
        return sysUserFaceInfoMapper.insert(record);
    }

    @Override
    public SysUserFaceInfo selectByPrimaryKey(Integer id) {
        return sysUserFaceInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKey(SysUserFaceInfo record) {
        return sysUserFaceInfoMapper.updateByPrimaryKey(record);
    }

    @Override
    @Transactional
    public void insertSelective(SysUserFaceInfo userFaceInfo) {
        sysUserFaceInfoMapper.insertUserFaceInfo(userFaceInfo);
    }


    /**
     * 查询用户人脸识别
     *
     * @param id 用户人脸识别ID
     * @return 用户人脸识别
     */
    @Override
    public SysUserFaceInfo selectSysUserFaceInfoById(Long id) {
        return sysUserFaceInfoMapper.selectSysUserFaceInfoById(id);
    }

    /**
     * 查询用户人脸识别列表
     *
     * @param sysUserFaceInfo 用户人脸识别
     * @return 用户人脸识别
     */
    @Override
    public List<SysUserFaceInfo> selectSysUserFaceInfoList(SysUserFaceInfo sysUserFaceInfo) {
        return sysUserFaceInfoMapper.selectSysUserFaceInfoList(sysUserFaceInfo);
    }

    /**
     * 新增用户人脸识别
     *
     * @param sysUserFaceInfo 用户人脸识别
     * @return 结果
     */
    @Override
    public int insertSysUserFaceInfo(SysUserFaceInfo sysUserFaceInfo) {
        sysUserFaceInfo.setCreateTime(DateUtils.getNowDate());
        return sysUserFaceInfoMapper.insertSysUserFaceInfo(sysUserFaceInfo);
    }

    /**
     * 修改用户人脸识别
     *
     * @param sysUserFaceInfo 用户人脸识别
     * @return 结果
     */
    @Override
    public int updateSysUserFaceInfo(SysUserFaceInfo sysUserFaceInfo) {
        sysUserFaceInfo.setUpdateTime(DateUtils.getNowDate());
        return sysUserFaceInfoMapper.updateSysUserFaceInfo(sysUserFaceInfo);
    }

    /**
     * 批量删除用户人脸识别
     *
     * @param ids 需要删除的用户人脸识别ID
     * @return 结果
     */
    @Override
    public int deleteSysUserFaceInfoByIds(Long[] ids) {
        return sysUserFaceInfoMapper.deleteSysUserFaceInfoByIds(ids);
    }

    /**
     * 删除用户人脸识别信息
     *
     * @param id 用户人脸识别ID
     * @return 结果
     */
    @Override
    public int deleteSysUserFaceInfoById(Long id) {
        return sysUserFaceInfoMapper.deleteSysUserFaceInfoById(id);
    }

}
